const app = getApp()
Page({
  data: {
    deviceID: null,
    logList: [
      {
        id: 0,
        name: '设备日志',
        icon: app.getImgUrl('deviceFolder.svg'),
        link: '/pages/device/logs/device/index',
      },
      {
        id: 0,
        name: '录像日志',
        icon: app.getImgUrl('videoFolder.svg'),
        link: '/pages/device/logs/video/index',
      },
      {
        id: 0,
        name: '运行日志',
        icon: app.getImgUrl('netFolder.svg'),
        link: '/pages/device/logs/running/index',
      }
    ]
  },
  onLoad(option) {
    if (!option.id) {
      wx.showToast({
        title: '参数错误',
        icon: 'error'
      })
      wx.navigateBack()
    } else {
      this.setData({
        deviceID: option.id
      })
    }
  },
  toPage(e) {
    const link = `${e.currentTarget.dataset.link}?id=${this.data.deviceID}`
    app.navigateTo(link)
  }
})